package com.honglang.struts2.action;


import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class BaseAction{
	
	
	public HttpServletRequest getRequest(){
		
		return ServletActionContext.getRequest();
	}
	
	public HttpServletResponse getResponse(){
		
		return ServletActionContext.getResponse();
	}
	
	public  HttpSession getSession(){
		return ServletActionContext.getRequest().getSession();
	}
	
	public WebApplicationContext getWebApplicationContext(){
		return WebApplicationContextUtils.getWebApplicationContext(ServletActionContext.getServletContext());
	}
	
	
	public ServletContext getServletContext(){
		return ServletActionContext.getRequest().getSession().getServletContext();
	}
	
	public Map<String,Object> getApplication(){
		return ServletActionContext.getContext().getApplication();
		
	}
	
}
